const net = require('net')

const client = net.connect({port:8080}, function (){
    console.log('client connect!')
    client.write('hello world!')
})


client.on('data', function (data){
    console.log(data.toString())
    client.end()
})


client.on('end', function (){
    console.log('client end!')
})

client.on('error', function (err){
    console.log(err)
})
